export const idCard = (num: string) => {
  let birthday = "";
  if (num != null && num != "") {
    if (num.length == 15) {
      birthday = "19" + num.slice(6, 12);
    } else if (num.length == 18) {
      birthday = num.slice(6, 14);
    }
    birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
  }
  let sexStr = '', sex;
  if (parseInt(num.slice(-2, -1)) % 2 == 1) {
    sexStr = '男';
    sex = 1
  }
  else {
    sexStr = '女';
    sex = 0
  }
  const [year, month, day] = birthday.split('-');
  return {
    birthday,
    year,
    month,
    day,
    sex,
    sexStr
  }
}